using Microsoft.AspNetCore.Http;

namespace Vin.Extension.Exception.Middleware;

public class MicrosoftExceptionMiddleware(RequestDelegate next)
{
    public async Task Invoke(HttpContext context)
    {
        await next(context);
        if (context.Response.StatusCode != StatusCodes.Status200OK)
        {
            await ExceptionTool.CheckIsMicrosoftExceptionAsync(context);
        }
    }
}